package com.mycontact.client.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.mycontact.client.ClientFactory;
import com.mycontact.client.place.EditContactPlace;
import com.mycontact.client.ui.EditContactMainPanel;

public class MainPanelEditContactActivity extends AbstractActivity {
	private ClientFactory clientFactory;
	private String contactId;
	
	public MainPanelEditContactActivity(EditContactPlace place, ClientFactory cf) {
		contactId = place.getContactId();
		clientFactory = cf;
	}

	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		EditContactMainPanel editContactMainPanel = clientFactory.getEditContactMainPanel();
		editContactMainPanel.setClientFactory(clientFactory);
		editContactMainPanel.getContact(contactId);
		panel.setWidget(editContactMainPanel.asWidget());
	}
}
